<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>知识库</title>
<t:base type="ckeditor,jquery,easyui,tools,DatePicker"></t:base>
<script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
	<script type="text/javascript">

        $(function () {
            loadTree();
        });
        function loadTree(plazaName) {
            rightTree = $("#tree").tree({
                url: "zyEmValidaRuleController.do?dataGridOfChooseEquipmentType",
                checkbox: true,
                onLoadSuccess : function(node) {
                    var protypeIds = $("#protypeId").val();
                    var protypeArr = protypeIds.split(",");
					/*已勾选的id*/
                    $.each(protypeArr,function(idx,itm){
                        var node = $("#tree").tree("find",itm);
                        if(node != undefined && node.target != undefined){
                            $("#tree").tree("check",node.target);
                        }
                    })
					/*//不被选中
					 $.each(noEffProtypeIdArr,function(idx,itm){
					 var node = $("#tree").tree("find",itm);
					 if(node != undefined && node.target != undefined){
					 $("#tree").tree("uncheck",node.target);
					 }
					 })*/
                }
            });
        }

        function jiaoyan() {
            var value = $("#knowLedgeType option:selected").attr("value");
            if (value == "") {
                alert("请选择类别！");
                return false;
            }
            var node = $('#tree').tree('getChecked');
            var cnodeIds = '';
            var cnodeValues = '';
            for ( var i = 0; i < node.length; i++) {
                cnodeIds += node[i].id + ',';
                cnodeValues += node[i].text + ',';
            }
            cnodeIds = cnodeIds.substring(0, cnodeIds.length - 1);
            cnodeValues = cnodeValues.substring(0, cnodeValues.length - 1);
            $("#zyEsitemIds").val(cnodeIds);
            $("#zyEsItem").val(cnodeValues);
        }

	</script>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" layout="table" action="cbsAppKnowledgeController.do?doUpdate" tiptype="3" beforeSubmit="jiaoyan">
<input id="id" name="id" type="hidden" value="${cbsAppKnowledgePage.id }">
<input id="createName" name="createName" type="hidden" value="${cbsAppKnowledgePage.createName }">
<input id="createBy" name="createBy" type="hidden" value="${cbsAppKnowledgePage.createBy }">
<input id="createDate" name="createDate" type="hidden" value="${cbsAppKnowledgePage.createDate }">
<input id="updateName" name="updateName" type="hidden" value="${cbsAppKnowledgePage.updateName }">
<input id="updateBy" name="updateBy" type="hidden" value="${cbsAppKnowledgePage.updateBy }">
<input id="updateDate" name="updateDate" type="hidden" value="${cbsAppKnowledgePage.updateDate }">
	<table cellpadding="0" cellspacing="1" class="formtable">
		<tr>
			<td align="right" style="width:70px;">
				<label class="Validform_label">
					编号:
				</label>
			</td>
			<td class="value">
			    <input id="no" name="no" type="text" style="width: 200px" class="inputxt" value='${cbsAppKnowledgePage.no}' datatype="*1-20">
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">编号</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					标题:
				</label>
			</td>
			<td class="value">
			    <input id="title" name="title" type="text" style="width: 300px" class="inputxt" value='${cbsAppKnowledgePage.title}' datatype="*1-100">
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">标题</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					类别:
				</label>
			</td>
			<td class="value">
				<span>
					<select name="knowLedgeType" id="knowLedgeType" style="width: 200px" datatype="*1-100">
						<option value="">---请选择--- </option>
						<c:forEach items="${dataList }" var="depart">
						<option value="${depart.typecode }" <c:if test="${cbsAppKnowledgePage.knowLedgeType eq depart.typecode}" >selected="selected"</c:if> >${depart.typename }</option>
						</c:forEach>
					</select>
				</span>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">类别</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					适用机型:
				</label>
			</td>
			<td class="value">
				<%--<input name="type.id" type="hidden" id="type" />
				<input class="inputxt" id="zyEsItem" style="width: 300px" readonly="readonly" name="zyEsItem" datatype="*" value="${cbsAppKnowledgePage.zyEsItem}"/>
				<t:choose hiddenName="type" hiddenid="id" url="zyEsItemController.do?goChooseEquipmentTypeCheckbox" name="zyEquipmentTypeList"
						  icon="icon-search" title="机型" inputTextname="zyEsItem" textname="text" isclear="true" width="400px" height="500px" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">型号</label>--%>
				<input name="zyEsitemIds" type="hidden" id="zyEsitemIds" />
				<input name="zyEsItem" type="hidden" id="zyEsItem" />
				<input type="hidden" id="protypeId" value="${cbsAppKnowledgePage.zyEsitemIds}"/>
				<div region="center" style="padding: 1px;height: 150px;overflow-y: auto;">
					<div id="tree"></div>
				</div>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="Validform_label"> 可见<t:mutiLang langKey="common.role"/>: </label></td>
			<td class="value" nowrap>
				<input name="roleid" type="hidden" value="${id}" id="roleid">
				<input name="roleName" class="inputxt" style="width: 300px" value="${roleName }" id="roleName" readonly="readonly" datatype="*" nullmsg="请选择角色"/>
				<t:choose hiddenName="roleid" hiddenid="id" url="userController.do?roles" name="roleList"
						  icon="icon-search" title="common.role.list" textname="roleName" isclear="true" height="500px" width="400px"/>
				<span class="Validform_checktip"><t:mutiLang langKey="role.muti.select"/></span>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					内容:
				</label>
			</td>
			<td class="value">
		  	 	<textarea id="content" style="width:'100%';height:270px;" class="inputxt" rows="6" name="content" maxlength="3300" datatype="*">${cbsAppKnowledgePage.content}</textarea>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">内容</label>
			</td>
		</tr>
	</table>
</t:formvalid>
 </body>
<script type="text/javascript" src="webpage/com/app/cbs_app_knowledge/cbsAppKnowledge-add.js"></script>